import { ApiProperty, PartialType } from '@nestjs/swagger';
import { CreatePermissionDto } from './create-permission.dto';
import { IsNotEmpty, IsOptional } from 'class-validator';

export class UpdatePermissionDto extends PartialType(CreatePermissionDto) {
	@ApiProperty({
		example: '添加菜单',
		required: true,
		description: '权限名称',
	})
	@IsNotEmpty()
	name: string;

	@ApiProperty({
		example: 'menu:add',
		required: true,
		description: '授权标识',
	})
	@IsNotEmpty()
	resource: string;

	@ApiProperty({
		required: false,
		description: '权限说明',
	})
	@IsOptional()
	description: string;

	@ApiProperty({
		required: false,
		description: '父级权限',
	})
	@IsOptional()
	parentId: number;
}
